/**
 * 
 */
package ch.unisi.inf.pfii.teamwhite.risk.core.player;

import java.util.ArrayList;

import junit.framework.TestCase;
import ch.unisi.inf.pfii.teamwhite.risk.core.Planet;


public class AiTest extends TestCase {

	public void testEnemyNeighbours()
	{
		ArrayList<Planet> enemies = new ArrayList<Planet>();
		Player player1 = new Human("User");
		Player player2 = new Human("Bob");
		Player player3 = new Human("Alice");
		Player player4 = new Human("ranga");
		
		Planet planet1 = new Planet("Uranus",player1,2000);
		Planet planet2 = new Planet("Neptune",player2,2000);
		Planet planet3 = new Planet("Pluto",player3,2000);
		Planet planet4 = new Planet("Earth", player4, 2000);	
		
		enemies.add(planet1);
		enemies.add(planet2);
		enemies.add(planet3);	
		planet4.setNeighbours(enemies);
		
		Ai ai = new Ai("CiaoBetty");
		//ai.TestNumberOfEnemyNeighbours(planet4);
		//assertEquals(3, ai.TestNumberOfEnemyNeighbours(planet4));
	}	
	
	public void testAiChooseOnePlanet()
	{
		Player player1 = new Gaia();
		
		Planet planet1 = new Planet("Mars",player1,2000);
		Planet planet2 = new Planet("Venus",player1,2000);
		Planet planet3 = new Planet("Saturn",player1,2000);
		
		ArrayList<Planet> planets = new ArrayList<Planet>();
		planets.add(planet1);
		planets.add(planet2);
		planets.add(planet3);
		Ai ai = new Ai("CiaoBetty");
		//assertEquals(planet1, ai.TestAiChooseOnePlanet(planets));
		}
	
	public void testAssignPlanets()
	{
		Player player1 = new Gaia();
		
		Planet planet1 = new Planet("Mars",player1,2000);
		Planet planet2 = new Planet("Venus",player1,2000);
		Planet planet3 = new Planet("Saturn",player1,2000);
		
		ArrayList<Planet> planets = new ArrayList<Planet>();
		planets.add(planet1);
		planets.add(planet2);
		planets.add(planet3);
		
		Ai ai = new Ai("CiaoBetty");
		//ai.getAssignPlanets(planets);		
		assertEquals(planet3.getOwner(), planet1.getOwner());
		}
	
	public void testAiBuild()
	{
		ArrayList<Planet> enemies = new ArrayList<Planet>();
		Player player1 = new Human("User");
		Player player2 = new Human("Bob");
		Player player3 = new Human("Alice");
		Player player4 = new Human("Ranga");
		
		Planet planet1 = new Planet("Uranus",player1,2000);
		Planet planet2 = new Planet("Neptune",player2,2000);
		Planet planet3 = new Planet("Pluto",player3,2000);
		Planet planet4 = new Planet("Earth", player4, 2000);
		
		enemies.add(planet1);
		enemies.add(planet2);
		enemies.add(planet3);
		
		planet4.setNeighbours(enemies);
		Ai ai = new Ai("CiaoBetty");
		//ai.getAiBuild(enemies);
		
		assertEquals(true, planet1.getBuilding().getName() == "Slavery Camp"
			|| planet1.getBuilding().getName() == "Tax Center");
		assertTrue(planet2.getBuilding().getName() == "Slavery Camp"
			|| planet2.getBuilding().getName() == "Tax Center");
		assertTrue(planet3.getBuilding().getName() == "Slavery Camp"
			|| planet3.getBuilding().getName() == "Tax Center");		
	}
	
	public void testAiBuyShip()
	{
		ArrayList<Planet> enemies = new ArrayList<Planet>();
		Player player1 = new Human("User");
		Player player2 = new Human("Bob");
		Player player3 = new Human("Alice");
		Player player4 = new Human("Ranga");
		
		Planet planet1 = new Planet("Uranus",player1,2000);
		Planet planet2 = new Planet("Neptune",player2,2000);
		Planet planet3 = new Planet("Pluto",player3,2000);
		Planet planet4 = new Planet("Earth", player4, 2000);
		
		enemies.add(planet1);
		enemies.add(planet2);
		enemies.add(planet3);
		
		planet4.setNeighbours(enemies);
		Ai ai = new Ai("CiaoBetty");
		//ai.TestAiBuyShip(enemies);
		
		assertEquals(1500, planet3.getShips().get(0).getCost());
		assertTrue(planet2.getShips().get(0).getCost() == 1500);
		assertTrue(planet1.getShips().get(0).getCost() == 1500);
	}
	
	//public void test
	
}
